#!/bin/bash

# PowerShell Go Build Script
set -e

echo "Building PowerShell Go..."

# Create bin directory
mkdir -p bin

# Build CLI version
echo "Building CLI version..."
GOOS=windows GOARCH=amd64 go build -o bin/pwsh-go.exe ./cmd/pwsh-go
GOOS=linux GOARCH=amd64 go build -o bin/pwsh-go-linux ./cmd/pwsh-go
GOOS=darwin GOARCH=amd64 go build -o bin/pwsh-go-darwin ./cmd/pwsh-go

# Build Web version
echo "Building Web version..."
GOOS=windows GOARCH=amd64 go build -o bin/pwsh-go-web.exe ./cmd/pwsh-go-web
GOOS=linux GOARCH=amd64 go build -o bin/pwsh-go-web-linux ./cmd/pwsh-go-web
GOOS=darwin GOARCH=amd64 go build -o bin/pwsh-go-web-darwin ./cmd/pwsh-go-web

# Build for current platform
echo "Building for current platform..."
go build -o bin/pwsh-go ./cmd/pwsh-go
go build -o bin/pwsh-go-web ./cmd/pwsh-go-web

echo "Build completed successfully!"
echo "Binaries are available in the bin/ directory"